#include "Thermo.h"
#include "mock/ArduinoMock.h"
#include "mock/MessageRouterMock.h"
using ::testing::_;
using ::testing::Return;
using ::testing::AnyNumber;

class ThermoTest : public ::testing::Test {
public:
	ThermoTest() : pin(33) {}
protected:
	ArduinoMock arduino;
	MessageRouterMock router;
	int pin;
};

TEST_F(ThermoTest, thermo){
	
	EXPECT_CALL(arduino, pin(pin, arduino.IN()));
	EXPECT_CALL(arduino, dWrite(pin, arduino.HIGHVAL()));
	Thermo t(arduino, router, "thermo", pin);

	EXPECT_CALL(arduino, dRead(pin)).
		Times(3).
		WillRepeatedly(Return(arduino.LOWVAL()));
	t.tick(11000);
	t.tick(16000);
	t.tick(26000);
}

